package view;



import javax.management.Query;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class Index {
    Font button = new Font("楷体", Font.BOLD, 20);
    Font head = new Font("黑体", Font.BOLD, 50);


    JFrame indexFrame = new JFrame("主界面");
    private final JButton query = new JButton("余额");
    private final JButton transfer = new JButton("转账");
    private final JButton quit = new JButton("退出");
    private JButton in = new JButton("存入");
    private JButton out = new JButton("取出");

    private JLabel hJLabel = new JLabel("请选择您要进行的操作");




    private void init(){
        indexFrame.setBounds(300, 100, 1000, 675);
        //设置退出
        indexFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //取消框架格式
        indexFrame.setLayout(null);

        hJLabel.setBounds(240,50,600,100);
        hJLabel.setFont(head);

        query.setBounds(0,250, 80, 50);
        query.setFont(button);
        transfer.setBounds(0,350, 80, 50);
        transfer.setFont(button);
        quit.setBounds(920,450, 80, 50);
        quit.setFont(button);
        in.setBounds(920,250, 80, 50);
        in.setFont(button);
        out.setBounds(920,350, 80, 50);
        out.setFont(button);

        indexFrame.add(query);
        indexFrame.add(transfer);
        indexFrame.add(quit);
        indexFrame.add(in);
        indexFrame.add(out);
        indexFrame.add(hJLabel);

        ((JComponent) indexFrame.getContentPane()).setOpaque(false); //将框架强转为容器
        ImageIcon img = new ImageIcon("images//LoginBackground.jpg"); //传入背景图片路径
        JLabel background = new JLabel(img);//将图片放进标签里
        indexFrame.getLayeredPane().add(background, Integer.valueOf(Integer.MIN_VALUE));//将标签放进容器里
        background.setBounds(0, 0, img.getIconWidth(), img.getIconHeight());//设置标签的大小

        indexFrame.setVisible(true);

    }



    void clean(){
        indexFrame.remove(query);
        indexFrame.remove(transfer);
        indexFrame.remove(in);
        indexFrame.remove(out);
        indexFrame.remove(hJLabel);
        indexFrame.remove(quit);
        //indexFrame.repaint();
    }

    public static void main(String[] args) {
        Index index = new Index();
    }
}
